import http from 'http'
import express from 'express'

import PROJECT from '../PROJECT'
import './global'

const start = middlewares => {
  const app = express()
  app.use('/favicon.ico', (req, res) => { res.send('ok') })
  app.use(ENV.PUBLIC, express.static(PROJECT.BUILD_CLIENT.ROOT) )
  app.use(middlewares)
  http.createServer(app).listen(ENV.PORT, ENV.HOST, () => {
    console.log('start!')
  })
}

export default start
